import socket

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

server.bind(('localhost',8888))

server.listen(5)

client,addr = server.accept()

print('客户端连接成功：',addr)

data = client.recv(1024)
print('收到数据：',data.decode())
msg = input("请输入你要和客户端回复的消息：")

client.send(msg.encode())

client.close()
server.close()